package com.glory.hzlionpda.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.hzlionpda.R;
import com.glory.hzlionpda.bean.MessageObject;

import java.util.List;

/**
 * @author anyang
 * @date 2017/9/11
 * @desc
 */

public class MessageListAdapter extends BaseQuickAdapter<MessageObject, BaseViewHolder> {

    public MessageListAdapter(@Nullable List<MessageObject> data) {
        super(R.layout.adapter_messages_list, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, MessageObject item) {
        switch (item.getCOLOR().toLowerCase()) {
            case "green":
                helper.setTextColor(R.id.tvContent, mContext.getResources().getColor(R.color.colorGreen));
                break;
            case "black":
                helper.setTextColor(R.id.tvContent, mContext.getResources().getColor(R.color.free_ui_dark_gold_text_black));
                break;
            case "red":
                helper.setTextColor(R.id.tvContent, mContext.getResources().getColor(R.color.free_ui_fire_red_theme_color));
                break;
        }
        helper.setText(R.id.tvContent, item.getLOGMESSAGETEXT());
    }
}
